home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tcl / demos / showVars.tcl < prev    next >
Encoding:
Text File  |  1992-08-13  |  825 b   |  27 lines

  1. # showVars w var var var ...
  2. #
  3. # Create a top-level window that displays a bunch of global variable values
  4. # and keeps the display up-to-date even when the variables change value
  5. #
  6. # Arguments:
  7. #    w -    Name to use for new top-level window.
  8. #    var -    Name of variable to monitor.
  9.  
  10. proc showVars {w args} {
  11.     catch {destroy $w}
  12.     toplevel $w
  13.     wm title $w "Variable values"
  14.     label $w.title -text "Variable values:" -width 20 -anchor center \
  15.         -font -Adobe-helvetica-medium-r-normal--*-180*
  16.     pack append $w $w.title {top fillx}
  17.     foreach i $args {
  18.     frame $w.$i
  19.     label $w.$i.name -text "$i: "
  20.     label $w.$i.value -textvar $i
  21.     pack append $w.$i $w.$i.name left $w.$i.value left
  22.     pack append $w $w.$i {top frame w}
  23.     }
  24.     button $w.ok -text OK -command "destroy $w"
  25.     pack append $w $w.ok {bottom pady 2}
  26. }
  27.